<template>
	<div class="myteam">
		<div class="top flex-row flex-between">
			<div>
				<div class="tips">收益金额</div>
				<div class="nums">￥{{balance}}</div>
			</div>
			<div class="flex-row tixian">
				<image src='../../static/icon/qianbao.png' class="qianbao"></image>
				<view>提现</view>
				<image src="../../static/icon/right_white.png" class="arrow"></image>
			</div>
		</div>
		<div class="content">
			<div class="teamBox flex-row flex-between" @click="goDetail">
				<div>我的团队:{{num}}人</div>
				<image src="../../static/icon/right_arrow.png"></image>
			</div>
			<div class="listBox" v-if='num>0'>
				<div class="list flex-row flex-between">
					<div class="info">
						<div class="title">获得来自XXX用户的收益</div>
						<div class="time">2020-02-18</div>
					</div>
					<div class="pay">+23<text>元</text></div>
				</div>
				<div class="list flex-row flex-between">
					<div class="info">
						<div class="title">获得来自XXX用户的收益</div>
						<div class="time">2020-02-18</div>
					</div>
					<div class="pays">+23<text>元</text></div>
				</div>
			</div>
			<div v-if='num==0' class='textCenter mgTop20'>暂无数据</div>
		</div>
	</div>
</template>

<script>
	export default{
		data(){
			return{
				dataList:[],
				num:0,
				currentPage:1,
				size:20,
				balance:''
			}
		},
		mounted() {
		this.getTeam()	
		this.getInfo()	
		},
		methods:{
			getInfo(){
				let id = uni.getStorageSync('userId')
				this.$http.get('/userCenter/getUserInfoById', {id:id}).then(res => {
					if (res.code == '0') {
						this.balance = res.data.balance;
					}
				})
			},
			getTeam(){
				let id = uni.getStorageSync('userId')
				this.$http.get('/userCenter/getMyEarningsList', {size:this.size,current:this.currentPage,id:id}).then(res => {
					if (res.code == 0) {
						this.dataList = res.data.records
							
						if(res.data.records.length){
								this.num = res.data.records.length
						}else{
								this.num = 0
						}
					console.log( this.num)
					}else{
						uni.showToast({
							icon:"none",
							title:res.msg
						})
					}
				})
			},
			goDetail(){
				uni.navigateTo({
					url:'/pages/person/teamNumber'
				})
			}
		}
	}
</script>
<style scoped lang="scss">
	
	.myteam{
		.top{
			height: 240upx;
			background: #FD580A;
			padding: 0 30upx;
			color: #fff;
			.tips{
				color: rgba(255,255,255,0.5);
				font-size: 30upx;
				padding-bottom: 30upx;
			}
			.nums{
				font-size: 30upx;
			}
			.tixian{
				align-items: center;
				font-size: 30upx;
				color: #fff;
				>view{
					padding: 0 15upx;
				}
				.qianbao{
					width: 22upx;
					height: 24upx;
					vertical-align: middle;
				}
				.arrow{
					width: 15upx;
					height: 24upx;
					vertical-align: middle;
				}
			}
		}
		.content{
			.teamBox{
				padding: 35upx 30upx;
				color: #22222A;
				font-size: 30upx;
				background: #fff;
				>image{
					width: 15upx;
					height: 26upx;
				}
			}
			.listBox{
				margin-top: 20upx;
				background-color: #fff;
				padding: 0 30upx;
				.list{
					padding: 32upx 0;
					border-bottom: 1upx solid rgba(238,238,238,1);
					&:last-child{
						border-bottom: none;
					}
					.title{
						font-size: 30upx;
						color: #22222A;
						padding-bottom: 30upx;
					}
					.time{
						color: #9A9A9A;
						font-size: 24upx;
					}
					.pay{
						color: #FE590B;
						font-size: 30upx;
						text{
							color: #000000;
						}
					}
					.pays{
						color: #39D214;
						font-size: 30upx;
						text{
							color: #000000;
						}
					}
				}
			}
		}
	}
</style>
